﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Net.Mail;

using System.Web.Services;
using AjaxControlToolkit;
using System.IO.MemoryMappedFiles;

public partial class partner_ViewProfilePartner : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["email"] == null)
        {
            Response.Redirect("sessiont.aspx");
        }
        Label6.Text = Session["email"].ToString();
        SqlConnection conn = null;
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn.Open();
        if (Page.IsPostBack)
        {
        }
        else
        {
            SqlCommand scmd = new SqlCommand("SELECT * FROM agent_add where email='" + Session["email"] + "'", conn);

            SqlDataReader dr = scmd.ExecuteReader();
            if (dr.Read())
            {


                txtfname1.Text = dr[2].ToString();
                txtmname.Text = dr[3].ToString();
                txtlname1.Text = dr[4].ToString();
                txtdob1.Text = dr[5].ToString();
                txtoccupation.Text = dr[6].ToString();
                txthno.Text = dr[7].ToString();
                txtcity.Text = dr[8].ToString();
                txtstreet.Text = dr[9].ToString();
                txtssn.Text = dr[10].ToString();
                txtzip.Text = dr[11].ToString();
                txtcountry.Text = dr[12].ToString();
                txtemail.Text = dr[13].ToString();
                txtpass.Text = dr[14].ToString();
                type.Text = dr[15].ToString();




            }


            dr.Close();
        }
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        Response.Redirect("../partner.aspx");
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        SqlConnection conn = null;
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString);
        conn.Open();

        SqlCommand cm1 = new SqlCommand("update agent_add set f_name='" + txtfname1.Text + "', m_name='" + txtmname.Text + "',l_name ='" + txtlname1.Text + "', d_o_b='" + txtdob1.Text + "',occu='" + txtoccupation.Text + "',h_no='" + txthno.Text + "',city='" + txtcity.Text + "', street='" + txtstreet.Text + "',ssn='" + txtssn.Text + "', zip_code='" + txtzip.Text + "',country='" + txtcountry.Text + "',pass='" + txtpass.Text + "' where email='" + Session["email"] + "'", conn);
        cm1.ExecuteNonQuery();

        conn.Close();
        Response.Redirect("partner_update_agent_conf.aspx");
    }
}